T - | Generic type of object to use protocol for.public class AutoProtocol<T> extends SerializationProtocol<T>
createBlankInstance(Class) should be overridden. ALso you should createBlankInstance(Class) when you object is to complex!| Constructor and Description |
|---|
AutoProtocol(java.lang.Class<T> applicableFor,
java.lang.String... fieldNamesToSerialize) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<? extends T> |
applicableFor() |
T |
createBlankInstance(java.lang.Class<? extends T> objectClass) |
java.lang.Object[] |
serialize(T object) |
T |
unserialize(java.lang.Class<? extends T> objectClass,
java.lang.Object... args) |
equals, isActive, setActive, toStringpublic AutoProtocol(java.lang.Class<T> applicableFor, java.lang.String... fieldNamesToSerialize) throws java.beans.IntrospectionException
applicableFor - | Class that can be serialized using this protocol.fieldNamesToSerialize - | Names of fields to serialize, if empty array is put there then all fields with public and valid getters and setters will be serialized!java.beans.IntrospectionException - when there are no field with valid and public getters and setters.public T createBlankInstance(java.lang.Class<? extends T> objectClass) throws java.lang.Exception
objectClass - | Class to create new instance of!Serializer#Instantiate(objectClass)java.lang.Exception - if any exception occurs (based on implementation).public java.lang.Object[] serialize(T object)
serialize in class SerializationProtocol<T>object - | The object.public T unserialize(java.lang.Class<? extends T> objectClass, java.lang.Object... args) throws java.lang.Exception
unserialize in class SerializationProtocol<T>objectClass - | The class of object that should be created. This can be useful when object T has children classes with same constructors. You can use reflection to make protocol working also for these child classes!args - | Args to create obj T from.T created from args.java.lang.Exception - you can just pass exception to Serializer if you are not interested in handling it on your own.public java.lang.Class<? extends T> applicableFor()
applicableFor in class SerializationProtocol<T>T